package com.itheima.myfile;

import java.io.File;
import java.io.IOException;

public class Demo2 {
    public static void main(String[] args) throws IOException {
        File file1 = new File("D:\\黑马课件\\aaa");
        //判断文件夹是否存在
        if(!file1.exists()){
            boolean res = file1.mkdirs();
        }

        //需求在bbb下新建一个abc.txt和java
        File file2 = new File(file1,"abc.txt");
        File file3 = new File(file1,"HelloJava");
        file2.createNewFile();
        file2.createNewFile();
        //判断abc.txt是否为一个文件
        System.out.println(file2.isFile());
        //判断hellowjava是不是一个文件
        System.out.println(file3.isDirectory());
        //abc.txt输出打印
        System.out.println(file2.getName());
        //将abc.txt删掉
        boolean b = file2.delete();
        System.out.println("b = " + b);
    }
}
